home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / ST007.422 < prev    next >
Text File  |  1993-03-07  |  4KB  |  113 lines

  1. 1ST007: 5^Z key lets you get mainmenu any time!
  2. Starship Trooper #1 @12754 9═2God9═0
  3. Wed Mar 03 17:36:40 1993
  4. /*
  5.  *Name       : Main Menu Anywhere
  6.  *Filename   : ST007.MOD                (alternate: getmain.mod)
  7.  *Description: The ^Z key can summon a main menu prompt, from within anything.
  8.  *Difficulty : Block copying.
  9.  *Version    : 4.22
  10.  *Files      : COM.C only!
  11.  *Author     : Starship Trooper 1@2750 Net  1@12754 Link
  12.  *Date       : Mar 1993
  13.  */
  14.  
  15. Much like ST005, this is a standard feature of the UNIX operating system.
  16. In most UNIX programs, you can press control-Z to "Suspend" the process,
  17. putting it in the background.  You will then be at the shell prompt, and
  18. can do whatever you want before calling your original process back.
  19.  
  20. I have added this feature to WWIV.  ^Z can be used anywhere (just like
  21. ^T (time report)).  Some possible uses:
  22.  
  23.     --A remote user is reading the mod sub, and wants to capture a post
  24.       without the annoying 3[PAUSE]0.  He can ^Z, change the 'D'efaults
  25.       to eliminate the pause, and return to the Read: prompt.
  26.  
  27.     --Drop out of an N-scan to look up a subtype in //BOARDEDIT
  28.  
  29.     --While reading mail, ^Z out and fix whatever was requested
  30.  
  31. This can be used locally or thru a modem.  After you see the main menu prompt
  32. once, you will be returned to your former position, with the line of text you
  33. were currently at restored.
  34.  
  35. 1. File COM.C, near the top
  36.  
  37. void mainmenu2(void);
  38.  
  39. 2. Still in COM.C, search for 'case 20' and add case 26 after it:
  40.  
  41.       case 20:
  42.         if (echo)
  43.           ptime();
  44.         break;
  45.       case 26:                           /* add st007 */
  46.           if ((usernum>0) && (actsl>10)) /* add */
  47.               mainmenu2();               /* add */
  48.           break;                         /* add */
  49.       case 18:
  50.         if (echo)
  51.  
  52.       (the 'if' is necessary so ^Z is not available at the NN: prompt!)
  53.  
  54. 3. Add this function at the bottom of COM.C:
  55.  
  56. void mainmenu2(void) {
  57.     unsigned char x,y;
  58.     int i;
  59.     unsigned savelin[80];
  60.     union REGS r;
  61.  
  62.     r.h.ah=0x03;
  63.     r.h.bh=0x00;
  64.     int86(0x10, &r, &r);
  65.     x=r.h.dl;
  66.     y=r.h.dh;
  67.     for (i=0; i<x; i++) {
  68.        r.h.ah=0x02;
  69.        r.h.bh=0x00;
  70.        r.h.dl=i;
  71.        r.h.dh=y;
  72.        int86(0x10, &r, &r);
  73.        r.h.ah=0x08;
  74.        r.h.bh=0x00;
  75.        int86(0x10, &r, &r);
  76.        savelin[i]=r.x.ax;
  77.     }
  78.     pl("\r\n\nSuspended");
  79.     nl();
  80.     mainmenu();
  81.     nl();
  82.     for (i=0; i<x; i++) {
  83.         if (curatr==savelin[i]>>8) {
  84.             outchr(0x00FF & savelin[i]);
  85.         } else {
  86.             curatr=savelin[i]>>8;
  87.             setc(curatr);
  88.             outchr(0x00FF & savelin[i]);
  89.         }
  90.     }
  91. }
  92.  
  93.  (mainmenu2() preserves the current line of text, such as a prompt, runs
  94.   mainmenu(), then restores the original line)
  95.  
  96. 4. Compile and send me mail.  Or kill me.
  97.  
  98.                ------------------------------------
  99. <<< Bonus Mini-TrooperMod - (too trivial for its own file)
  100. <<<  add after the 'case's in mainmenu():
  101. <<<    default: if ((s[0]>'9') || (s[0]<'0'))
  102. <<<                pl("That key doesn't do anything!");
  103. <<<
  104.  
  105. ≡≡ TrooperWare/WWIV:
  106.  [ST001- Random sysop-unavailable      ][ST002- One-key user validation     ]
  107.  [ST003- Lock xfers during prime time  ][ST004- numlock light when user on  ]
  108.  [ST005- UNIX-like //FINGER            ][ST006- 95 colors                   ]
  109.  [ST007- ^Z summons main menu          ]
  110.  
  111.  [STRCOM - WWIV 4.22 String Compiler                                        ]
  112.  [ELLNET - replacement for LNET, but full-screen, color, menu, editing, more]
  113.